﻿<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>留言</title>
<link href="../../css/newStyle.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/gbRst.js"></script>
<script type="text/javascript" src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/openId.js"></script>
<script type="text/javascript" src="../../js/ajaxfileupload.js"></script> 
<script type="text/javascript" src="../../js/header&footer.js"></script>
<script type="text/javascript" src="../../js/check.js"></script>
<script type="text/javascript" src="../../js/jquery.qqFace.js"></script>
		<script type="text/javascript" src="../../js/qmsk-1.2.js"></script>
<script type="text/javascript">

function toSaveS(){ 

	var saytext=$("#saytext").val();
	var title = $("#title").val()
	if(IsEmpty(saytext)){
		alert("内容不能为空")
		$("#saytext").focus();
		return false;		
	}

	if(IsEmpty(title)){
		alert("标题")
		$("#title").focus();
		return false;		
	}

	var memberId = getIdByName("memberId");
	if(IsEmpty(memberId)){
		alert("您还不是会员，不能进行此操作")
		return false;
	}
	var userId = getIdByName("userId");
	if(IsEmpty(userId)){
		alert("您还没有选择要发消息的对象")
		return false;
	}
	var heads=new Array("content","memberId","userId","memberOpenId","shopId","title");
	var datas=new Array(saytext,memberId,userId,_openId,_shopId,title);
	var parser = new Object();
	var jsonParserStr = null;
	if (IsNotEmpty(datas)){
		addToParser(heads, datas, "add" , parser);
		jsonParserStr =  JSON.stringify(parser);
	}
	
	$.post("../../../customerMessage/insert/insertInfo",{"data":jsonParserStr}, function(data) {
		var dt = JSON.parse(data);	
				 if(IsEmpty(dt)){
					alert("操作出错")
					return false;
				}
				if(dt.state==0){
					alert("操作成功")
					window.location.href='mineData.html?openId='+_openId+"&shopId="+_shopId;
				}else if(dt.state==1){
					alert("操作出错")
				}
		
	});
}
function restForm(){
	$("#title").val("")
	$("#saytext").val("");
	$("#searchM").hide();
	
}
$(function(){
	$('.emotion').qqFace({
		assign:'saytext', //给那个控件赋值
		path:'../../images/face/'	//表情存放的路径
	});
});
//替换表情
</script>
</head>

<body>
<div class="wrapper">
    <div class="placeTit"><a class="back" onClick="javascript:history.go(-1)"></a>留言</div>
  <div class="container">
  	<p class="datas">主题<span class="red">*</span><br>
   	<input type="text" class="emptyInput" id="title">
    </p>
    <div class="showFaceTxt">
      <textarea class="saytext" id="saytext"></textarea>
      <div class="com_form">
        <p><span class="emotion"></span> </p>
      </div>
    </div>
      <div class="give">
        <input type="button" value="发帖" class="giveBtn" onclick="toSaveS()">
      </div>
  </div>
</div>
</body>
</html>
